- name: kubernetes.node
  rules:
    - alert: LoadBalancerServiceWithoutExternalIP
      expr: sum(kube_service_status_load_balancer_ingress or vector(0)) < sum(kube_service_spec_type{type="LoadBalancer"})
      for: 5m
      labels:
        severity_level: "4"
        tier: cluster
      annotations:
        plk_protocol_version: "1"
        plk_create_group_if_not_exists__cluster_has_node_alerts: "LoadBalancerServiceCluster,tier=cluster,prometheus=deckhouse,kubernetes=~kubernetes"
        plk_grouped_by__cluster_has_node_alerts: "LoadBalancerServiceCluster,tier=cluster,prometheus=deckhouse,kubernetes=~kubernetes"
        description: |-
          One or more services with the LoadBalancer type cannot get an external address.

          The list of services can be obtained with the following command:
          kubectl get svc -Ao json | jq -r '.items[] | select(.spec.type == "LoadBalancer") | select(.status.loadBalancer.ingress[0].ip == null) | "namespace: \(.metadata.namespace), name: \(.metadata.name), ip: \(.status.loadBalancer.ingress[0].ip)"'
          Check the cloud-controller-manager logs in the 'd8-cloud-provider-*' namespace
          If you are using a bare-metal cluster with the metallb module enabled, check that the address space of the pool has not been exhausted.
        summary: A load balancer has not been created.
